<?php $this->headLink()->appendStylesheet($this->css('SyntaxHighlighter.css'))?>
<?php $this->headScript()
->appendFile($this->js('SyntaxHighlighter/shCore.js'))
->appendFile($this->js('SyntaxHighlighter/shBrushCSharp.js'))
->appendFile($this->js('SyntaxHighlighter/shBrushXml.js'))
->captureStart()?>

$(document).ready(function(){
	dp.SyntaxHighlighter.ClipboardSwf = '<?php echo  $this->js('SyntaxHighlighter/clipboard.swf')?>';


	$("#code_menu a").click(function(){
		var id = $(this).attr('id');
		$.getJSON('<?php echo  $this->route('getcode')?>',
		{id: id , selTable:'<?php echo  $this->data['selTable']?>', selModule:'<?php echo  $this->data['selModule']?>'},
		function(res){
			if ($(".dp-highlighter").html()) {
				$(".dp-highlighter").remove();
			}
			$("#code").html(res.data);
			dp.SyntaxHighlighter.HighlightAll('code');
		});
	 });

	 $("#button").click(function(){
		$("#myform").submit();
	});

	$("#zipBtn").click(function(){
		var module = $("#selModule").attr('value');
		var table = $("#selTable").val();
		var str = '<?php echo $this->route('getzip')?>/moduleName/'+module+'/tableName/'+table;
		$("#zipform").attr('action',str).submit();
	});
});
<?php $this->headScript()->captureEnd()?>
<?php $this->headStyle()->captureStart()?>

#code_menu li {float:left;margin:10px}
#code {clear:both}
<?php $this->headStyle()->captureEnd()?>
<h1><?php echo $this->translate('Code generator')?></h1>
<form method="post" action="" id="zipform"></form>
<form name="myform" id="myform" action="<?php echo  $this->route('genclass')?>" method="post">
<div id="topsel">
<label for="selModule"><?php echo $this->translate('Module name')?> : </label><input type="text" id="selModule" name="selModule" size="10" value="<?php echo  $this->data['selModule']?>" />
<label for="selTable"><?php echo $this->translate('Table name')?>: </label><select name="selTable" id="selTable">
<?php foreach($this->tables as $val):?>
<option value="<?php echo  $val?>" <?php if($val == $this->data['selTable']):?> selected="selected"<?php endif?>><?php echo  $val?></option>
<?php endforeach?>
</select>
<input type="button" id="button" value="<?php echo $this->translate('Produce')?>" />
<input type="button"  id="zipBtn" value="<?php echo $this->translate('download zip file')?>" />

</div>
</form>
<?php if ($this->data):?>
<div id="code_menu">
<ul>
<li>models/<a href="#" id="object"><?php echo  $this->table_name?>.php</a></li>
<li>models/<a href="#" id="mapper"><?php echo  $this->table_name?>Mapper.php</a></li>
<li>models/DbTable/<a href="#" id="dbtable"><?php echo  $this->table_name?>.php</a></li>
<li>forms/<a href="#" id="form"><?php echo  $this->table_name?>.php</a></li>
<li>languages/<?php echo  $this->config['resources']['locale']['default']?>/Forms/<a href="#" id="language"><?php echo  $this->table_name?>.php</a></li>
</ul>

</div>
<pre id="code"  class="html" >
</pre>
<?php endif?>
